<h1>产品管理 - <span id="secondHeading">管理产品</span></h1>
<% if @flash[:notice] -%>
<div id="notice"><%= @flash[:notice] %></div>
<% end -%>
<%=form_tag({:action=>'list_product'}, :id=>"input-form")%>
<div id="searchBar">
	<img src="/images/opened1.gif"><a href="/product/list_product">显示正常产品</a>
	<img src="/images/locked.gif"><a href="/product/list_product?state=0">显示已停用产品</a>
</div>
<div style="margin-left:25px;">
	品名规格<input type="text" name="product_serial" maxlength="20">
	导针规格<input type="text" name="product_name" maxlength="20">&nbsp;<input type="submit" value="查询" class="sub">
</div>
</form>
<TABLE border="0" id="LIST_TB">
	<TR id="LIST_TB_TITLE">
      <td nowrap>品名规格</td>
      <td nowrap>导针规格</td>
      <td nowrap>F（槽宽）</td>
      <td nowrap>B（中径）</td>
      <td nowrap>P（脚距）</td>
      <td>入库日期</td>
      <td>单价</td>
      <!--
      <td>媒体价格</td>
      <td nowrap>个/箱</td>
      -->
      <td colspan="3">相关操作</td>
    </tr>
    <%@products.each do |product|%>
    <TR id="LIST_TB_CONTENT1">
      <td><%=product.serial%></td>
      <td><%=product.name%></td>
      <td><%=product.F%></td>
      <td><%=product.B%></td>
      <td><%=product.P%></td>
      <td><%=product.in_date_at%></td>
      <td><%=product.sale_price%></td>
      <!--
      <td><%=product.announce_price%></td>
      <td><%=product.number_per_box%></td>
      -->
      <td><a href="/product/show_product/<%=product.id%>"><img src="/images/product_info.gif" alt="显示产品信息"></a></td>
      <td><a href="/product/edit_product/<%=product.id%>"><img src="/images/edit.gif" alt="编辑产品信息"></a></td>
      <td>
              <%if product != nil && product.state == 1 %>
                      <a href="/product/stop_product/<%=product.id%>" onclick="return confirm('你确定停用该产品吗?');"><img src="/images/stop.gif" alt="停用产品"></a>
              <%else%>
                      <a href="/product/restart_product/<%=product.id%>" onclick="return confirm('你确定启用该产品吗?');"><img src="/images/restart.gif" alt="启用产品"></a>
              <%end%>
      </td>
    </tr>
    <%end%>
</table>
<table>
        <tr>
                <td>
                        <input type="button" value="打印当前页" class="sub" onclick="openPrintWindow('LIST_TB')"/>
                        <input type="button" value="导出当前数据" class="sub" onclick="CellAreaExcel('LIST_TB')"/>
                </td>
                <td>
                        <div class="pagination">
                        <ul>
                                <li class="btn">
                                <%if @product_pages.current.previous%>
                                <%=link_to("<<上一页", { :page => @product_pages.current.previous })%>
                                <%else%>
                                <span>&lt;&lt;上一页</span>
                                <%end%>
                        </li>
                        <li><%= pagination_links(@product_pages) if @product_pages%></li>
                                <li class="btn">
                                <%if @product_pages.current.next%>
                                <%=link_to("下一页>>", { :page => @product_pages.current.next })%>
                                <%else%>
                                <span>下一页&gt;&gt;</span>
                                <%end%>
                        <li>
                        </ul>
                        </div>
                </td>
        </tr>
</table>
